from django.db import models

# Create your models here.
class Computer(models.Model):
    Computer_ID = models.IntegerField(max_length=10)
    Frequency = models.IntegerField(max_length=10000)
    def __unicode__(self):
        return u'%s' % self.Computer_ID
    
class Booking(models.Model):
    computer =models.ForeignKey(Computer,blank=True,null=True)
    Date = models.DateField()
    def __unicode__(self):
        return u'%s' % self.Date

class Register(models.Model):
    Person_ID = models.CharField(max_length=20)
    Password = models.CharField(max_length=30)
    Name = models.CharField(max_length=30)
    SirName = models.CharField(max_length=30)
    Birth_date = models.DateField()
    Department = models.CharField(max_length=30)
    Email = Email = models.EmailField(max_length=70)
    def __unicode__(self):
        return u'%s' % self.Person_ID
    
class Booking_history(models.Model):
    register = models.ForeignKey(Register,blank=True,null=True)
    computer = models.ForeignKey(Computer,blank=True,null=True) 
    Date = models.CharField(max_length=15)
    Time = models.CharField(max_length=15)
    def __unicode__(self):
        return u'%s' % self.register.Person_ID

class User_Profile(models.Model):
    register = models.ForeignKey(Register,blank=True,null=True)
    Frequency = models.IntegerField(max_length=10)
    
class Timing(models.Model):
    booking = models.ForeignKey(Booking,blank=True,null=True)
    #computer =models.ForeignKey(Computer,blank=True,null=True)
    Time9_10 = models.CharField(max_length=20)
    Time10_11 = models.CharField(max_length=20)
    Time11_12 = models.CharField(max_length=20)
    Time12_13 = models.CharField(max_length=20)
    Time13_14 = models.CharField(max_length=20)
    Time14_15 = models.CharField(max_length=20)
    Time15_16 = models.CharField(max_length=20)
    Time16_17 = models.CharField(max_length=20)
    Time17_18 = models.CharField(max_length=20)
    Time18_19 = models.CharField(max_length=20)
    #Status = models.CharField(max_length=40)
    def __unicode__(self):
        return u'%s' % self.booking.computer.Computer_ID


class AdminLogin(models.Model):
    Admin_ID = models.CharField(max_length=10)
    Admin_Pass = models.CharField(max_length=15)
    Admin_Name = models.CharField(max_length=30)
    Admin_SirName = models.CharField(max_length=30)
    Admin_BirthDate = models.DateField()
    Admin_Department = models.CharField(max_length=30)
    Admin_Email = models.CharField(max_length=30)
    def __unicode__(self):
        return u'%s' % self.Admin_ID

class Computer_Fix(models.Model):
    Computer_ID = models.IntegerField(max_length=2)
    Status_Com = models.CharField(max_length=10)
    Date_Error = models.DateField()
    def __unicode__(self):
        return u'%s' % self.Computer_ID

class ComError_History(models.Model):
    Error_ID = models.IntegerField(max_length=2)
    Lose = models.IntegerField(max_length=4)
    Date_Lose = models.DateField()
    def __unicode__(self):
        return u'%s' % self.Error_ID
    
    
